#include"comm.hpp"
int main(){
    cout << "begin" << endl;
    int f = open(PIPE_NAME.c_str(),O_WRONLY);
    cout << "end" << endl;
    if(f == -1)
        cout << "not start server" <<endl;
    char buffer[1024] = { 0 };
    while(true){
        fgets(buffer, sizeof(buffer),stdin);  //fgets() auto add '\0'
        int n = strlen(buffer); 
        if(n > 0)
            buffer[n - 1] = '\0';
        int sz = write(f,buffer,n);
        assert(sz != -1);
    }
    return 0;
}